package com.hill.study;
//自定义异常类
public class MyException extends Exception {
    //传递年龄大于130，报错
    private int age;

    public MyException(int age) {
        this.age = age;
    }
    //toString :异常消息打印
    @Override
    public String toString() {
        return "MyException{" +
                "age=" + age +
                '}';
    }
}
